package com.company.test.collections;

import java.util.Objects;

/**
 * @author zhangyan
 * @version $ Id: User.java, v 0.1 2020/9/8 18:23 zhangyan Exp $
 */
public class User {
    private int age;
    private String userName;

    public User(int age, String userName) {
        this.age = age;
        this.userName = userName;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        User user = (User) o;
        return age == user.age &&
                Objects.equals(userName, user.userName);
    }

    @Override
    public int hashCode() {
        return age;
    }
}
